package sale.wxb.loveshopping.enums;

/**
 * 响应状态码 四位数的表示自定义的异常 通常是业务类型错误提示
 * 根据openapi-generator生成器只能是1-5开头的数字
 */
public enum ResponseEnum implements BaseEnum {
    SUCCESS(200, "操作成功"),
    // 客户端调用错误类
    PARAMS(400, "参数有误"),
    // 权限，认证类
    NOT_LOGIN(401, "未登录或登录已过期"),
    NOT_POWER(403, "没有该接口权限"),
    NOT_SUPPORTED_METHOD(405, "该接口不支持该请求方式"),
    // 系统服务错误
    SERVER_ERROR(500, "服务端出现错误"),
    // 业务错误类
    BUSINESS(1000, "操作失败"),
    SQL_ERROR(1010, "数据库操作异常"),
    UP_FAIL(1040, "密码错误"),
    NOT_ENABLE(1041, "该账号已被停用"),
    AUTH_FAIL(1042, "认证失败"),
    ACCOUNT_LOCKED(1043, "该账号已被锁定"),
    NOT_FOUND(1044, "没有找到该数据")
    ;
    private final int code;
    private final String message;

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    ResponseEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }
}
